package com.xiaoyu.izf.model;

import javax.persistence.*;
import java.sql.Timestamp;
import java.util.Objects;

@Entity
@Table(name = "order_info", schema = "izf", catalog = "")
public class OrderInfo {
    private String outTradeNo;
    private Integer uid;
    private String clientIp;
    private Integer orderStatus;
    private String channel;
    private Integer orderType; //订单类型，1:vip,2:商品
    private String orderId;
    private Integer totAmount;
    private Timestamp insertTime;
    private Timestamp payTime;
    private Integer isTest;

    @Id
    @Column(name = "out_trade_no")
    public String getOutTradeNo() {
        return outTradeNo;
    }

    public void setOutTradeNo(String outTradeNo) {
        this.outTradeNo = outTradeNo;
    }

    @Basic
    @Column(name = "uid")
    public Integer getUid() {
        return uid;
    }

    public void setUid(Integer uid) {
        this.uid = uid;
    }

    @Basic
    @Column(name = "client_ip")
    public String getClientIp() {
        return clientIp;
    }

    public void setClientIp(String clientIp) {
        this.clientIp = clientIp;
    }

    @Basic
    @Column(name = "order_status")
    public Integer getOrderStatus() {
        return orderStatus;
    }

    public void setOrderStatus(Integer orderStatus) {
        this.orderStatus = orderStatus;
    }

    @Basic
    @Column(name = "channel")
    public String getChannel() {
        return channel;
    }

    public void setChannel(String channel) {
        this.channel = channel;
    }

    @Basic
    @Column(name = "order_type")
    public Integer getOrderType() {
        return orderType;
    }

    public void setOrderType(Integer orderType) {
        this.orderType = orderType;
    }

    @Basic
    @Column(name = "order_id")
    public String getOrderId() {
        return orderId;
    }

    public void setOrderId(String orderId) {
        this.orderId = orderId;
    }

    @Basic
    @Column(name = "tot_amount")
    public Integer getTotAmount() {
        return totAmount;
    }

    public void setTotAmount(Integer totAmount) {
        this.totAmount = totAmount;
    }

    @Basic
    @Column(name = "insert_time")
    public Timestamp getInsertTime() {
        return insertTime;
    }

    public void setInsertTime(Timestamp insertTime) {
        this.insertTime = insertTime;
    }

    @Basic
    @Column(name = "pay_time")
    public Timestamp getPayTime() {
        return payTime;
    }

    public void setPayTime(Timestamp payTime) {
        this.payTime = payTime;
    }

    @Basic
    @Column(name = "is_test")
    public Integer getIsTest() {
        return isTest;
    }

    public void setIsTest(Integer isTest) {
        this.isTest = isTest;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        OrderInfo orderInfo = (OrderInfo) o;
        return Objects.equals(outTradeNo, orderInfo.outTradeNo) &&
                Objects.equals(uid, orderInfo.uid) &&
                Objects.equals(clientIp, orderInfo.clientIp) &&
                Objects.equals(orderStatus, orderInfo.orderStatus) &&
                Objects.equals(channel, orderInfo.channel) &&
                Objects.equals(orderType, orderInfo.orderType) &&
                Objects.equals(orderId, orderInfo.orderId) &&
                Objects.equals(totAmount, orderInfo.totAmount) &&
                Objects.equals(insertTime, orderInfo.insertTime) &&
                Objects.equals(payTime, orderInfo.payTime);
    }

    @Override
    public int hashCode() {
        return Objects.hash(outTradeNo, uid, clientIp, orderStatus, channel, orderType, orderId, totAmount, insertTime, payTime);
    }
}
